const path = require('path');
const CracoLessPlugin = require('craco-less');

module.exports = {
  babel: {
    plugins: [
      ['@babel/plugin-proposal-decorators', { legacy: true }],
      ['@babel/plugin-proposal-optional-chaining'],
      [
        'import',
        {
          libraryName: 'antd',
          libraryDirectory: 'es',
          style: 'css'
        }
      ]
    ]
  },
  plugins: [
    {
      plugin: CracoLessPlugin
    }
  ],
  webpack: {
    alias: {
      '@': path.resolve(__dirname, 'src')
    }
  },
  devServer: {
    proxy: {
      '/api': {
        target: '',
        changeOrigin: true,
        pathRewrite: {
          '/api': '/api'
        }
      }
    }
  }
};
